<#assign superClass=""/>
<#assign superGeneric=""/>
<#assign implements=""/>
<#if model.extendsSupperClass>
    <#assign superClass= "extends " + model.superClassName/>
    <#assign superGeneric= vmTools.buildGeneric(model.superGenericList)/>
    <#assign implements= " implements " + vmTools.buildImplements(model.implementsList)/>
</#if>
package ${packageName}.service.impl;

import org.springframework.stereotype.Service;
<#if model.basicApi>
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import ${packageName}.dto.${model.firstUpperCaseName}Dto;
import ${packageName}.dao.${model.firstUpperCaseName}Dao;
import ${model.responsePackageName};
</#if>
<#if model.importPackages??>
    <#list model.importPackages as pkg>
import ${pkg};
    </#list>
import java.util.List;
</#if>

/**
 * @ClasssName ${model.firstUpperCaseName}ServiceImpl
 * @Description ${model.comment}ServiceImpl
 * @Author ${author}
 * @Date ${date}
 * @Version V1.0
 */
@Service
<#if style == 'pl-web' || style == 'mybatis-plus'>
public class ${model.firstUpperCaseName}ServiceImpl ${superClass}${superGeneric}${implements} {
<#elseif style == 'mybatis'>
    public class ${model.firstUpperCaseName}ServiceImpl implements ${model.firstUpperCaseName}Service {
</#if>
<#if model.wired>
    <#if model.wiredType == 'resource'>

    @Resource
    private ${model.firstUpperCaseName}Dao ${model.firstLowerCaseName}Dao;
    </#if>
    <#if model.wiredType == 'autoWired'>

    @Autowired
    private ${model.firstUpperCaseName}Dao ${model.firstLowerCaseName}Dao;
    </#if>
    <#if model.wiredType == 'constructor'>

    private final ${model.firstUpperCaseName}Dao ${model.firstLowerCaseName};

    public ${model.firstUpperCaseName}ServiceImpl(${model.firstUpperCaseName}Dao ${model.firstLowerCaseName}Dao) {
        this.${model.firstLowerCaseName}Dao = ${model.firstLowerCaseName}Dao;
    }
    </#if>
    <#if model.basicApi>

    @Override
    public ${model.responseClassName} pagelist(${model.firstUpperCaseName}Dto ${model.firstLowerCaseName}Dto){
        PageHelper.startPage(${model.firstLowerCaseName}Dto.getPageNum(), ${model.firstLowerCaseName}Dto.getPageSize());
        List<${model.firstUpperCaseName}> list = ${model.firstLowerCaseName}Dao.selectList(${model.firstLowerCaseName}Dto);
        return ${model.responseClassName}.${model.successMethod}(PageUtils.getPageResult(new PageInfo(list)));
    }

    @Override
    public ${model.responseClassName} save(${model.firstUpperCaseName}Dto ${model.firstLowerCaseName}Dto){
        ${model.firstLowerCaseName}Dao.insert(${model.firstLowerCaseName}Dto);
        return ${model.responseClassName}.${model.successMethod}();
    }

    @Override
    public ${model.responseClassName} removeById(${model.firstUpperCaseName}Dto ${model.firstLowerCaseName}Dto){
        ${model.firstLowerCaseName}Dao.deleteById(${model.firstLowerCaseName}Dto);
        return ${model.responseClassName}.${model.successMethod}();
    }

    @Override
    public ${model.responseClassName} updateById(${model.firstUpperCaseName}Dto ${model.firstLowerCaseName}Dto){
        ${model.firstLowerCaseName}Dao.updateById(${model.firstLowerCaseName}Dto);
        return ${model.responseClassName}.${model.successMethod}();
    }

    @Override
    public ${model.responseClassName} getById(${model.firstUpperCaseName}Dto ${model.firstLowerCaseName}Dto){
        ${model.firstUpperCaseName} ${model.firstLowerCaseName} = ${model.firstLowerCaseName}Dao.getById(${model.firstLowerCaseName}Dto);
        return ${model.responseClassName}.${model.successMethod}(${model.firstLowerCaseName});
    }
    </#if>
</#if>

}
